/*
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-29 12:45:39
 * @Description  : 分享管理相关类型
 */

import type { PageRes, UserCommonRes } from './commom'
import type { SourceRowData } from './source'

export interface ShareReq {
  page?: number
  pageSize?: number
  userId?: string
  type?: number
  startTime?: string
  endTime?: string
}

export interface UserShareReq {
  page?: number
  pageSize?: number
  type?: number
  filename?: string
}

// share返回实体
export interface ShareRes {
  id: string
  title: string
  sourceId: string
  type: number
  code: string
  isActive: number
  isLink: number
  isShareTo: number
  numView: number
  numDownload: number
  deadline: string
  options: string
  createUser: string
  createTime: string
  User: UserCommonRes
  source: SourceRowData
  userInfo: string
}

// 分页share返回实体
export type SharePageRes = PageRes<ShareRes>

// 分享添加请求实体类型
export interface ShareCreateReq {
  title: string
  sourceId: string
}

// 分享修改请求实体
export interface ShareUpdateReq {
  title?: string
  shareId: string
  code?: string
  isShareTo?: number
  isLink?: number
  options?: any
  authTo?: {
    targetType: number
    targetId: string
    roleId: string
  }[]
  deadline?: string
}

// 分享取消请求实体
export interface ShareCancelReq {
  shareIds: string[]
  type: number
}

// 开启/关闭分享
export interface SetStatusShare {
  shareIds: string[]
  status: number
}

export type ShareRowData = ShareRes
